import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import Home from '../views/Home.vue'
import Index from '../views/Index.vue'



const routes: Array<RouteRecordRaw> = [

  
  // {
  //   path: '/center',
  //   name: 'center',
  //   components:{
  //     index:()=>import('../views/Index.vue'),
  //     good:()=>import('../views/Good.vue')
  //   }
  // },

  {
    path:'/',
    redirect: to=>{
      return 'login'
    }
   },

   {
    path:'/login',
    name: 'login',
    component:()=>import('../views/Login.vue')
   },


   {
    path: '/home',
    name: 'home',
    component:Home,
    children:[
      {path:'/home',redirect:'/index'},
      {
        path:'/index',
        name: 'index',
        component:()=>import('../views/Index.vue')
      },
      {path:'/gategory',name:'gategory',component:()=>import('../views/Gategory.vue')},
      {path:'/dish',name:'dish',component:()=>import('../views/Dish.vue')},
      {path:'/adddish',name:'adddish',component:()=>import('../views/AddDish.vue')},
      //修改菜品,路由传参
      {path:'/updatedish/:id',name:'updatedish',component:()=>import('../views/UpdateDish.vue')},
      {path:'/taocan',name:'taocan',component:()=>import('../views/Taocan.vue')},
      //修改套餐，
      {path:'/updatetaocan/:id',name:'updatetaocan',component:()=>import('../views/UpdateTaocan.vue')},
      {path:'/addtaocan',name:'addtaocan',component:()=>import('../views/AddTaocan.vue')},
      {path:'/user',name:'user',component:()=>import('../views/User.vue')},
      {path:'/order',name:'order',component:()=>import('../views/Order.vue')},
      //数据统计
      {path:'/data',name:'data',component:()=>import('../views/Data.vue')},
      {path:'/flavour',name:'flavour',component:()=>import('../views/Flavour.vue')},
      //标签
      {path:'/tag',name:'tag',component:()=>import('../views/Tag.vue')}
    ] 
   },
  
  //个人主页
  {path:'/userinfo',name:'userinfo',component:()=>import('../views/UserInfo.vue')}
  
   
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})



export default router
